<?php
$this->menu=array(
    array('label'=>'Generate this report','url'=>array('generate','id'=>$model->id)),
	array('label'=>'List report', 'url'=>array('list')),
	array('label'=>'Create report', 'url'=>array('create')),
	array('label'=>'Update report', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete report', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
);
?>

<h1>Cargo listing</h1>

<div class="row">
	<?php //echo CHtml::activeLabelEx($model,'searchText'); ?>
	<?php //echo CHtml::activeTextField($model,'searchText'); ?>
</div>

<?php 
$this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'report-grid',
        'dataProvider'=>$model->search(),
        'columns'=>array(
                'date:date:Creation date',
                'type',
                'attn:text:Reporting for',
                'title',
                'remark',		
                array(
                        'class'=>'CButtonColumn',
                        'template'=>'{view} {update}',
                ),
        ),
)); 
?>
<?php
$cs = Yii::app()->getClientScript();
$searchURL = CHtml::normalizeUrl(array('cargo/list'));

$script =<<<EOD
$('input#cargo_searchText').keypress(function(event){
	if(event.keyCode == '13'){
		$.fn.yiiListView.update('cargo_list',{url:'$searchURL',data:{searchText:$(this).val()}});
	}
});
EOD;
$cs->registerScript("packageScript",$script,CClientScript::POS_END);
?>